package com.jl.jlapp.mvp.activity;

import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.Toast;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter.OnItemChildClickListener;
import com.jl.jlapp.R;
import com.jl.jlapp.adapter.ShouldEvaluationOrderListAdapter;
import com.jl.jlapp.eneity.OrderDetail;
import com.jl.jlapp.eneity.OrderDetail.ResultDataBean;
import com.jl.jlapp.eneity.OrderDetail.ResultDataBean.OrderDetailsBean;
import com.jl.jlapp.nets.Api;
import com.jl.jlapp.nets.CommonObserver;
import com.jl.jlapp.nets.Net;
import com.jl.jlapp.utils.Tools;
import io.reactivex.Flowable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import java.util.List;

public class ShouldEvaluationActivity
  extends AppCompatActivity
{
  @BindView(R.id.back)
  ImageView back;
  @BindView(R.id.edit_evaluation_content_recycler_view)
  RecyclerView editEvaluationContentRecyclerView;
  List<OrderDetail.ResultDataBean.OrderDetailsBean> orderDetailsBeans;
  int orderId = 0;
  private ProgressDialog progressDialog;
  OrderDetail.ResultDataBean resultDataBean;
  ShouldEvaluationOrderListAdapter shouldEvaluationOrderListAdapter;
  int userId = 0;
  
  public void buildProgressDialog()
  {
    if (this.progressDialog == null)
    {
      this.progressDialog = new ProgressDialog(this);
      this.progressDialog.setProgressStyle(0);
    }
    this.progressDialog.setMessage("加载中");
    this.progressDialog.setCancelable(true);
    this.progressDialog.show();
  }
  
  public void cancelProgressDialog()
  {
    if ((this.progressDialog != null) && (this.progressDialog.isShowing())) {
      this.progressDialog.dismiss();
    }
  }
  
  public void getOrderDetailNoEvaluation(Integer paramInteger1, Integer paramInteger2)
  {
    Net.get().getOrderDetailNoEvaluation(paramInteger2.intValue(), paramInteger1.intValue())
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new CommonObserver<OrderDetail>() {
              @Override
              protected void onError(String errorMsg) {

              }

              @Override
              protected void onSuccess(OrderDetail orderDetail) {

              }
            });
  }
  
  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(R.layout.fragment_edit_evaluation);
    ButterKnife.bind(this);
    this.back.setOnClickListener(new OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        ShouldEvaluationActivity.this.finish();
      }
    });
  }
  
  protected void onResume()
  {
    super.onResume();
    this.userId = getSharedPreferences("JLAppData", 0).getInt("userId", 0);
    if (this.userId > 0)
    {
      buildProgressDialog();
      this.orderId = getIntent().getIntExtra("orderId", 0);
      getOrderDetailNoEvaluation(Integer.valueOf(this.userId), Integer.valueOf(this.orderId));
      return;
    }
    Toast.makeText(this, "您还未登录，请先登录。", Toast.LENGTH_SHORT).show();
    startActivity(new Intent(this, LoginActivity.class));
  }
  
  public void setAdapter()
  {
    this.editEvaluationContentRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    this.shouldEvaluationOrderListAdapter = new ShouldEvaluationOrderListAdapter(R.layout.should_evaluation_list_item, this.orderDetailsBeans);
    this.editEvaluationContentRecyclerView.setAdapter(this.shouldEvaluationOrderListAdapter);
    this.shouldEvaluationOrderListAdapter.setOnItemChildClickListener(new OnItemChildClickListener()
    {
      public void onItemChildClick(BaseQuickAdapter paramAnonymousBaseQuickAdapter, View paramAnonymousView, int paramAnonymousInt)
      {
//        switch (paramAnonymousView.getId())
//        {
//        default:
//          return;
//        }
        Tools.addActivity(ShouldEvaluationActivity.this);
        Intent intent = new Intent(ShouldEvaluationActivity.this, EditEvaluationActivity.class);
        intent.putExtra("orderId", ShouldEvaluationActivity.this.orderId);
        intent.putExtra("orderDetailId", ((OrderDetail.ResultDataBean.OrderDetailsBean)ShouldEvaluationActivity.this.orderDetailsBeans.get(paramAnonymousInt)).getId());
        intent.putExtra("orderDetailPic", ((OrderDetail.ResultDataBean.OrderDetailsBean)ShouldEvaluationActivity.this.orderDetailsBeans.get(paramAnonymousInt)).getGoodsCoverUrl());
        intent.putExtra("orderDetailNum", ShouldEvaluationActivity.this.orderDetailsBeans.size());
        ShouldEvaluationActivity.this.startActivity(intent);
      }
    });
  }
}


/* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/mvp/activity/ShouldEvaluationActivity.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */